#ifndef PALETTE_SHOWER_H
#define PALETTE_SHOWER_H

#include <QWidget>

#include <QGraphicsScene>
#include <QGraphicsView>

#include <QImage>
#include <QPainter>

#include <QGraphicsSceneMouseEvent>
#include <QDebug>
#include <QLayout>

#include "Palette/Palette.h"

class ImageScene;

class PaletteShower : public QWidget
{
Q_OBJECT

public:
    explicit PaletteShower(QWidget *parent = nullptr);
    ~PaletteShower() override;

    void updateImage();
    uint8_t pick_color_id = 0;
    uint8_t pass_color_id = 0;
    void setPalette(Palette &palette);

private:
    Palette palette;

    QHBoxLayout *horizontalLayout;
    QGraphicsView *graphicsView1;
    QGraphicsView *graphicsView2;

	ImageScene *scene;
	ImageScene *scene2;
};

class ImageScene : public QGraphicsScene
{
public:
    ImageScene();
    explicit ImageScene(QObject* parent);
    ~ImageScene() override;
    uint8_t pick_color_id = 0;
    uint8_t pass_color_id = 0;

    void setPaletteShower(PaletteShower* paletteShower);

private:
    PaletteShower* paletteShower;
    void mousePressEvent(QGraphicsSceneMouseEvent* event) override;
    void mouseMoveEvent(QGraphicsSceneMouseEvent* event) override;
};

#endif // PALETTE_SHOWER_H
